package com.thinkingcoder.tccache.core.command.list;

import static com.thinkingcoder.tccache.constant.CommandConstants.ListCmd.LLEN;

import com.thinkingcoder.tccache.core.command.Command;
import com.thinkingcoder.tccache.core.model.Reply;
import com.thinkingcoder.tccache.core.TcCache;

/**
 * LLEN command.
 */
public class LLenCmd implements Command {
    @Override
    public String name() {
        return LLEN;
    }

    @Override
    public Reply<?> exec(TcCache cache, String[] args) {
        String key = getKey(args);

        return Reply.integer(cache.lLen(key));
    }
}
